import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { FontUtil } from "../../../common/font/FontUtil";
import { BitmapLabel } from "../../../component/BitmapLabel";
import { RollRadioInfo } from "../../model/RollRadioInfo";
import { HTMLUtil } from "../../../../com/gengine/utils/HTMLUtil";
import { ObjectPool } from "../../../../com/gengine/utils/pools/ObjectPool";
type int = number;
//class RollRadioItem
    
    export  class RollRadioItem /* flash.display.Sprite */
    {
        constructor(arg1: int=750)
        {
            
            this._width = arg1;
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            mouseEnabled = false;
            mouseChildren = false;
            this.scrollRect = new Object /* flash.geom.Rectangle */(0, 0, this._width, this._height);
            this._skin = GlobalClass.getScaleBitmap(ImagesConst.rollmsgbg, new Object /* flash.geom.Rectangle */(130, 10, 5, 5));
            this._skin.width = this._width;
            this._skin.height = this._height;
            addChild(this._skin);
            this._textField = new Object /* flash.text.TextField */();
            this._textField.selectable = false;
            this._textField.height = 24;
            this._textField.filters = [FilterConst.nameGlowFilter];
            var loc1=new GTextFormat(FontUtil.songtiName, 14, 16776960, false, null, null, null, null, flash.text.TextFormatAlign.LEFT);
            loc1.letterSpacing = 2;
            this._textField.defaultTextFormat = loc1;
            this._textField.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._bmpLabel = new BitmapLabel();
            this._bmpLabel.textField = this._textField;
            this._bmpLabel.x = 0;
            this._bmpLabel.y = 7;
            addChild(this._bmpLabel);
            this.cacheAsBitmap = true;
            return;
        }

        public updateData(arg1: RollRadioInfo): void
        {
            this._info = arg1;
            this._bmpLabel.htmlText = HTMLUtil.addColor(arg1.str, "#ffffff");
            this._bmpLabel.x = this._width;
            var loc1;
            var loc2=((loc1 = this._info).count + 1);
            loc1.count = loc2;
            return;
        }

        public frameScript(): void
        {
            this._bmpLabel.x = this._bmpLabel.x - this._info.speed;
            return;
        }

        public dispose(): void
        {
            if (this._info) 
            {
                ObjectPool.disposeObject(this._info);
            }
            this._info = null;
            this._bmpLabel.x = this._width;
            return;
        }

        public get running(): Boolean
        {
            return this._info && this._bmpLabel.x >= -this._bmpLabel.textWidth;
        }

        public get hasEnd(): Boolean
        {
            return this._info && this._info.count >= this._info.totalCount;
        }

        public get info(): RollRadioInfo
        {
            return this._info;
        }

        public /* override */ get height(): number
        {
            return this._height;
        }

        public /* override */ get width(): number
        {
            return this._width;
        }

        /* internal */ /* var */_textField: Object /* flash.text.TextField */;

        /* internal */ /* var */_info: RollRadioInfo;

        /* internal */ /* var */_skin: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_height: int=30;

        /* internal */ /* var */_bmpLabel: BitmapLabel;
    }
